package almacenes.modelo.dao.impl;


import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;


import almacenes.modelo.dao.ParametroDao;
import almacenes.modelo.entidad.ParametroDet;

public class ParametroDaoImpl extends GeneralesDaoImpl implements ParametroDao  {
	private Log logger = LogFactory.getLog(this.getClass());

	@SuppressWarnings("unchecked")
	public List<ParametroDet> obtenerTiposDeEstados(String sCodTabla)
			throws HibernateException {
		this.logger.info("obtenerTiposDeEstado");
		List<ParametroDet> lstParametroDet = null;

		try {
			iniciaOperacion();
			lstParametroDet = sesion
					.createQuery(
							"select distinct(pd) from ParametroDet pd inner join pd.parametroCab as pc "
									+ "where pc in (select pc from ParametroCab pc where pc.codParamCabBbva = :AC_COD_PARAM_BBVA" +
									") and pd.codigo in (1,0)")
					.setParameter("AC_COD_PARAM_BBVA", sCodTabla).list();
			
			
		}catch (Exception ex) {
			this.logger.error(ex.getMessage());
		} finally {
			sesion.close();
		}

		return lstParametroDet;
	}

	@Override
	public ParametroDet obtenerEstadoPorCodigo(String sCodTabla,
			String sCodEstado, Session sesion) {
		// TODO Auto-generated method stub
		return null;
	}

}
